import { request } from "@/utils/request";
import { requestFy } from "@/utils/request";

//获取基本，调运、网贷状态
export function getPurManagementLists(purId) {
  return requestFy({
    url: "/purchase-management/get?id=" + purId,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
//获取关联订单状态
export function getPurOrderLinked(purId) {
  return request({
    url:
      "/queue/purchase-management-control/find-linked_order-by-purchaserId?id=" +
      purId,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 获取当前登录采购商id
export function getPurIds(userId) {
  return requestFy({
    url: "/coal-pruchase-behalf/find-purchaserId/" + userId,
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}
// 查询供应商列表
// export function getSupLists(purId) {
// 	return requestFy({
// 		url: '/coal-supplier/find-purchaserId?purchaserId=' +purId,
// 		headers: {
// 			isToken: true
// 		},
// 		'method': 'GET',
// 		// 'data': data
// 	})
// }
// export function getSupLists(purId) {
// 	return request({
// 		url: '/queue/cust-mgr/get-simple-list?purchaserId=' +purId,
// 		headers: {
// 			isToken: true
// 		},
// 		'method': 'GET',
// 		// 'data': data
// 	})
// }
export function getSupLists(purId) {
  return request({
    url: "/queue/cust-mgr/get-supplier-simple-list?purchaserId=" + purId,
    headers: {
      isToken: true,
    },
    method: "GET",
    // 'data': data
  });
}
export function getCoalSourceLists() {
  return request({
    url: "/system/coalSource/getList",
    headers: {
      isToken: true,
    },
    method: "GET",
    // 'data': data
  });
}

export function getCoalPurOrderLists(purId) {
  return request({
    url: "/inventory/purchase-order/get-simple-list?purchaserId=" + purId,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
export function getPurOrderDatas(id) {
  return request({
    url: "/inventory/purchase-order/get?id=" + id,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 查询装货地列表
// export function getLoadLists(purId) {
// 	return requestFy({
// 		url: '/load-site/find-loading-site?purchaserId=' +purId,
// 		headers: {
// 			isToken: true
// 		},
// 		'method': 'GET',
// 		// 'data': data
// 	})
// }
export function getLoadLists(data) {
  return request({
    url: "/queue/load-site-mgr/get-simple-list",
    headers: {
      isToken: true,
    },
    method: "GET",
    data: data,
  });
}
// 查询卸货地列表
// export function getDisChargeLists(purId) {
// 	return requestFy({
// 		url: '/load-site/find-landing-site?purchaserId=' +purId,
// 		headers: {
// 			isToken: true
// 		},
// 		'method': 'GET',
// 	})
// }
export function getDisChargeLists(datas) {
  return request({
    url: "/queue/load-site-mgr/get-simple-list",
    headers: {
      isToken: true,
    },
    method: "GET",
    data: datas,
  });
}
// 查询产品列表
export function getProNameLists(supId) {
  return request({
    // url: '/purchase-prosup/find-pro-sup-name/'+supId,
    url: "/queue/supplier-product/getBySupplierId?supplierId=" + supId,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 获得货主精简信息
export function getCargoownerLists(networkFreightId) {
  return request({
    url:
      "/queue/cargo-owner/get-simple-list?networkFreight=" + networkFreightId,
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}

// 获取代理商数据信息
export function getAgentLists(companyId) {
  return request({
    url: "/queue/freight-kamo/get-shippers?companyId=" + companyId,
    headers: {
      isToken: false,
    },
    method: "GET",
  });
}

// 新增
export function transportPlanCreate(data) {
  return request({
    url: "/queue/transport-plan/create",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}
// 更新运价
export function freightUpdate(datas) {
  return request({
    url: "/queue/transport-plan/update-freight",
    headers: {
      isToken: true,
    },
    method: "PUT",
    data: datas,
  });
}
// 详情
export function getDetails(id) {
  return request({
    url: "/queue/transport-plan/get?id=" + id,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 取消
export function cancelOne(id) {
  return request({
    url: "/queue/transport-plan/cancellation?id=" + id,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
//获得字典数据
export function getDictDatas() {
  return request({
    url: `/system/dict-data/list-all-simple`,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
// 运单详情
export function getWayBillDetails(id) {
  return requestFy({
    url:
      "/purchase-coal-send-car/show-orderDetails-from-consolidation?id=" + id,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
//
export function getPlanConfig(tenantId) {
  return requestFy({
    url: "/coal-basisDeploy/find-tenant/" + tenantId,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
//获取erp关联信息
export function getERPMessLists(billNo) {
  return request({
    url:
      "/queue/transport-plan/get-purchase-transport-plan-applet?billNo=" +
      billNo,
    headers: {
      isToken: true,
    },
    method: "GET",
  });
}
